package com.yunli.mall;

import com.yunli.mall.common.util.BeanContext;
import com.yunli.mall.mq.redis.RedisConsumer;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

@MapperScan(value = {"com.yunli.mall.repository"})
@SpringBootApplication(scanBasePackages = {"com.yunli.mall"})
public class SeckillApplication {
    public static void main(String[] args) {
        SpringApplication.run(SeckillApplication.class, args);
        ExecutorService threadPool = Executors.newSingleThreadExecutor();
        threadPool.execute((Runnable) BeanContext.getObject(RedisConsumer.class));
    }
}
